package com.woniuxy.micromedicalserver.hospitalmanage.service.impl;

import com.woniuxy.micromedicalserver.bean.HospitalBean;
import com.woniuxy.micromedicalserver.hospitalmanage.mapper.HospitalMapper;
import com.woniuxy.micromedicalserver.hospitalmanage.service.IHospitalService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;


@Service
@Transactional(readOnly = true)
public class HospitalServiceImpl implements IHospitalService {

    @Resource
    private HospitalMapper hospitalMapperImpl;

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public Integer insertHospital(HospitalBean hospitalBean) {
        return hospitalMapperImpl.insertHospital(hospitalBean);
    }

    @Override
    public HospitalBean selectByID(Integer ID) {
        return hospitalMapperImpl.selectByID(ID);
    }

    @Override
    public List<HospitalBean> selectAllHospital(HospitalBean hospitalBean) {
        return hospitalMapperImpl.selectAllHospital(hospitalBean);
    }

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public void updateHospital(HospitalBean hospitalBean) {
        hospitalMapperImpl.updateHospital(hospitalBean);
    }
}
